﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Player
    {
        int HP;
        int MP;
        int ATK;
        int DEF;

        public Player(int hP, int mP, int aTK, int dEF)
        {
            HP = hP;
            MP = mP;
            ATK = aTK;
            DEF = dEF;
        }

        public int HP1 { get => HP; set => HP = value; }
        public int MP1 { get => MP; set => MP = value; }
        public int ATK1 { get => ATK; set => ATK = value; }
        public int DEF1 { get => DEF; set => DEF = value; }
    }

    class Monster
    {
        int HP;
        int ATK;
        int DEF;

        public Monster(int hP, int aTK, int dEF)
        {
            HP = hP;
            ATK = aTK;
            DEF = dEF;
        }

        public int HP1 { get => HP; set => HP = value; }
        public int ATK1 { get => ATK; set => ATK = value; }
        public int DEF1 { get => DEF; set => DEF = value; }
    }
    class Program
    {
        static void Main(string[] args)
        {
//            实际伤害计算公式：
//实际伤害 = 攻击方输出 * 602 /（防御方实际物防 + 602）
//假设攻击方输出1000，防御方实际物防按上文550算
//因此实际伤害为1000 * 602 /（550 + 602）= 523
//ps：攻击方输出：如果为技能伤害那就是，技能固定数值 + 物攻数值 * 技能百分比
//如果为普攻伤害直接就是，物攻数值
        
           Player player1 = new Player(10000, 2000, 550, 800);
            Monster monster1 = new Monster(2000, 100, 300);
            Monster monster2 = new Monster(3000, 200, 200);
            Monster monster3 = new Monster(1000, 300, 100);
            for(int i=1; monster1.HP1>0; i++)
            {
                monster1.HP1 = monster1.HP1-player1.ATK1 * 602 / (monster1.DEF1 + 602);
                player1.HP1 = player1.HP1-monster1.ATK1 * 602 / (player1.DEF1 + 602);
                player1.MP1 = player1.MP1-10;
                if (monster1.HP1 < 0)
                {
                    monster1.HP1 = 0;
                }
                Console.WriteLine("第" + i + "次攻击玩家生命力为：" +player1.HP1);
                Console.WriteLine("第" + i + "次攻击怪物生命力为：" +monster1.HP1);
                Console.WriteLine("第" + i + "次攻击玩家 蓝量 为：" +player1.MP1);
                Console.WriteLine("....................");

            }
            Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~");
            Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~");
            Console.WriteLine("开始攻击第二个怪物");

            for (int i = 1; monster2.HP1 > 0; i++)
            {
                monster2.HP1 = monster2.HP1 - player1.ATK1 * 602 / (monster2.DEF1 + 602);
                player1.HP1 = player1.HP1 - monster2.ATK1 * 602 / (player1.DEF1 + 602);
                player1.MP1 = player1.MP1 - 10;
                if (monster2.HP1 < 0)
                {          
                    monster2.HP1 = 0;
                }
                Console.WriteLine("第" + i + "次攻击玩家生命力为：" + player1.HP1);
                Console.WriteLine("第" + i + "次攻击怪物生命力为：" + monster2.HP1);
                Console.WriteLine("第" + i + "次攻击玩家 蓝量 为：" + player1.MP1);
                Console.WriteLine("....................");
            }
            Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~");
            Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~");
            Console.WriteLine("开始攻击第三个怪物");
            for (int i = 1; monster3.HP1 > 0; i++)
            {
                monster3.HP1 = monster3.HP1 - player1.ATK1 * 602 / (monster3.DEF1 + 602);
                player1.HP1 = player1.HP1 - monster3.ATK1 * 602 / (player1.DEF1 + 602);
                player1.MP1 = player1.MP1 - 10;
                if (monster3.HP1 < 0)
                {
                    monster3.HP1 = 0;
                }
                Console.WriteLine("第" + i + "次攻击玩家生命力为：" + player1.HP1);
                Console.WriteLine("第" + i + "次攻击怪物生命力为：" + monster3.HP1);
                Console.WriteLine("第" + i + "次攻击玩家 蓝量 为：" + player1.MP1);
                Console.WriteLine("....................");

            }
            Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~");
            Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~");
            Console.WriteLine("击败三个怪物后，最终玩家血量，蓝量为：" + player1.HP1+";" + player1.MP1);

        }
    }
}
